<template>
  <div>
    <el-row :gutter="15">
      <el-col :span="9">
      <span style="margin-left: 200px">审批不通过原因</span>
      </el-col>
      <el-col :span="6">
      <el-input style="margin-left: 10px;height: 100px" type="textarea" v-model="examineMessage">如果审批不通过则不能为空</el-input>
      </el-col>
    </el-row>
    <div>
      <el-button size="mini" @click="examine(1)" >不同意</el-button>
      <el-button size="mini" type="primary" @click="examine(0)"
      >同意</el-button
      >
    </div>
  </div>
</template>

<script>

import { ajax } from "@/store/yg/common/utils";

export default {
  props: ["row", "data", "more"],
  data() {
    return {
      examineMessage: null
    };
  },
  methods: {
    examine(Status){
      var param = {};
      if(Status===1 && this.examineMessage==null){
        this.$message.error("不同意审批的原因不能为空");
        return;
      }
        param["examineMessage"] = this.examineMessage;
        console.log(this.$store.state.edit);
        param["id"]= this.$store.state.edit.id;
        param["status"]=  Status;
      const attrs = {
        class: 'com.tofba.app.client.setting.ShippingfbaStockClient'
      }
      ajax("examine", param,attrs).then(
        res => {
          console.log(res);
          if (res.code != 200) {
            this.$message.error(res.message);
          } else {
            this.$message.success("修改成功");
            window.location.reload(true);
          }
        },
        error => {
          console.log(error);
        }
      );

    }
  }
};
</script>

<style scoped>
</style>
